﻿#if DOTWEEN && UNITY
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DG.Tweening;
using UnityEngine;
using UnityEngine.UI;
namespace com.susi.util
{
    public static class TweenViaDoTween
    {
        public static Tween DoIntCounter(this Text text, float endtime)
        {
            void _setter(float v)
            {
                text.text = ((int)v).ToString();
            }
            return DOTween.To(() => 0f, _setter, 0f, endtime - Time.time);
        }

        //public static Tween DoIntCounter(dynamic text, float endtime)
        //{
        //    void _setter(float v)
        //    {
        //        text.text = ((int)v).ToString();
        //    }
        //    return DOTween.To(() => 0f, _setter, 0f, endtime - Time.time);
        //}
    }
}
#endif
